namespace PHMEE.PHM.Algorithms.Basic;

/// <summary>
/// 倒谱算法
/// </summary>
public class CepstrumAlg
{
    private readonly CepstrumService.CepstrumServiceClient _client;

    public CepstrumAlg(CepstrumService.CepstrumServiceClient client)
    {
        _client = client;
    }
    
    /// <summary>
    /// 倒谱算法
    /// </summary>
    /// <param name="accData">加速度 振动信号时域序列</param>
    /// <param name="sampleRate">采样频率</param>
    /// <returns></returns>
    public CepstrumResponse Cepstrum(float[] accData, float sampleRate)
    {
        var request = new CepstrumRequest
        {
            AccData = {accData},
            SampleRate = sampleRate
        };
        
        return _client.CepstrumAlg(request);
    }
    
    /// <summary>
    /// 倒谱算法
    /// </summary>
    /// <param name="accData">加速度 振动信号时域序列</param>
    /// <param name="sampleRate">采样频率</param>
    /// <returns></returns>
    public async Task<CepstrumResponse> CepstrumAsync(float[] accData, float sampleRate)
    {
        var request = new CepstrumRequest
        {
            AccData = {accData},
            SampleRate = sampleRate
        };
        
        return await _client.CepstrumAlgAsync(request);
    }
}